/**
 * @(#) EpuckMotorActuator.java
 */

package pcsr.drivers.epuckDriver;

class EpuckMotorActuator implements IEpuckActuator
{
	enum EpuckMotorSide	{ LEFT,RIGHT; }
	private EPuck epuckrobot;
	private EpuckMotorSide motorside;
	private short position;
	
	private short speed;
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public String GetID() {
		return motorside.name();
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public EpuckActuatorMode GetMode() {
		return EpuckActuatorMode.SETVALUEONLY;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public EpuckActuatorType GetType() {
		return EpuckActuatorType.MOTOR;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public short GetValue() {
		return GetSpeed();
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public void SetValue(short newValue) {
		SetSpeed(newValue);
		epuckrobot.SendActuatorUpdateCommand(this);
	}

	short GetPosition() {
		return position;
	}

	short GetSpeed() {
		return speed;
	}

	/**
	 * @param newValue
	 */
	void SetPosition(short newValue) {
		position = newValue;
	}

	/**
	 * @param newValue
	 */
	void SetSpeed(short newValue) {
		speed = newValue;
	}
	
	public EpuckMotorActuator(EPuck owner, EpuckMotorSide side) {
		epuckrobot = owner;
		motorside = side;
	}
	
}
